/**
 * FlightDb.java
 * Jan 11, 2010
 */
package com.dlplay.flightinfo.db;


import java.util.Collection;
import java.util.Date;
import java.util.List;

import javax.persistence.EntityManager;

import com.dlplay.flightinfo.data.AirFlightCode;
import com.dlplay.flightinfo.data.Airport;
import com.dlplay.flightinfo.data.AirportTerminalCode;
import com.dlplay.flightinfo.data.CityCode;
import com.dlplay.flightinfo.data.EMailRegister;
import com.dlplay.flightinfo.data.FlightInfo;
import com.dlplay.flightinfo.data.FlightRegInfo;
import com.dlplay.flightinfo.data.RealTimeFlightInfo;

/**
 * @author zhao yu
 *
 */
public interface FlightInfoDbMngr {

	/**
	 * 
	 * Get EntityManager
	 * 
	 */
	EntityManager getEntityManager();
	
	/**
	 * @param airport
	 * Description: insert a new airport to DB              
	 */
	void addAirport(Airport airport);
	
	/**
	 * Save a <code>Info</code> to the data store, updating it.
	 * @param Info the <code>Info</code> to save
	 * 
	 */
	void updateAirport(Airport airport);
	
	/**
	 * @param terminal
	 * @return if no found, return null
	 * Description: get the airport
	 */
	Airport getAirport(AirportTerminalCode terminal);
	
	/**
	 * Delete an <code>Info</code> from the data store.
	 * @param User the <code>Info</code> to delete
	 * 
	 */
	void deleteAirport(AirportTerminalCode terminal);
	
	/**
	 * @return List<Airport>
	 * Description: get all airport in DB
	 */
	List<Airport> getAirports();
	
	/**
	 * @param from
	 * @param to
	 * @param date
	 * @return 
	 * Description: search the flights in date
	 */
	List<FlightInfo> getFlightInfo(CityCode from, CityCode to, Date date);

	/**
	 * @param flightNumber, not null
	 * @param date, not null
	 * @return if no found, return null
	 * Description: search the flight in date
	 */
	FlightInfo getFlightInfo(AirFlightCode flightNumber, Date date);

	/**
	 * @param info
	 * Description: create a new real time flight info
	 */
	void addRealTimeFlightInfo(RealTimeFlightInfo info);

	/**
	 * @param info
	 * Description: update an exist real time flight info
	 */
	void updateRealTimeFlightInfo(RealTimeFlightInfo info);

	/**
	 * @param flightNumber
	 * @return
	 * Description: find the real time flight info
	 */
	RealTimeFlightInfo getRealTimeFlightInfo(AirFlightCode flightNumber);

	/**
	 * @return flight number list
	 * Description: get all the registered flight number
	 */
	List<AirFlightCode> getRegisteredFlights();

	/**
	 * @param flightNum
	 * @param email
	 * @return if no found, return null
	 * Description: find the Email register by flightNum and email
	 */
	EMailRegister getFlightEmailRegister(AirFlightCode flightNum, String email);

	/**
	 * @param reg
	 * Description: add a new email register
	 */
	void addFlightRegister(EMailRegister reg);



	
}
